package mya.mes.mdc.queries.alarm;

import mya.common.jpa.context.ServiceContext;
import mya.mes.mdc.model.alarm.MdcAlarmType;

import java.util.List;

public class MdcAlarmTypeQuery {

    public static List<MdcAlarmType> byMdcTag(ServiceContext context, String mdcTag) throws Exception {

        List<MdcAlarmType> list = context.em.createNamedQuery("MdcAlarmType.byMdcTag", MdcAlarmType.class)
                .setParameter(1, mdcTag)
                //   .setLockMode(LockModeType.PESSIMISTIC_WRITE)
                .getResultList();


        return list;
    }


    public static List<MdcAlarmType> loadAll(ServiceContext context) throws Exception {
        List<MdcAlarmType> list = context.em.createNamedQuery("MdcAlarmType.loadAll", MdcAlarmType.class)
                .getResultList();
        return list;
    }
}
